⚡ [Performance] Parallelize apply operations across realms#60
Conversation
Uses `tokio::task::JoinSet` to concurrently process multiple realms during the `apply` operation, drastically reducing total execution time for multi-realm deployments. Also introduces `bench_apply.rs` to measure the performance baseline. Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
==========================================
+ Coverage 89.80% 89.84% +0.04%
==========================================
Files 38 38
Lines 2501 2511 +10
==========================================
+ Hits 2246 2256 +10
Misses 255 255 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
💡 What:
runfunction insrc/apply/mod.rsto spawntokio::task::JoinSettasks for each realm, executingapply_single_realmconcurrently rather than sequentially.benches/bench_apply.rsto establish a performance baseline for the apply command across a large number of realms.🎯 Why:
Previously,
kcd applyprocessed realms sequentially in a standardforloop. When dealing with dozens or hundreds of realms, this caused severe I/O bottlenecks and unnecessary latency since cross-realm dependencies do not exist at the Keycloak configuration level. Parallelizing this at the realm level is analogous to how theplanandinspectmodules were already optimized.📊 Measured Improvement:
Created a benchmark script (
bench_apply.rs) testing the apply functionality on a mock workspace containing 100 auto-generated realms using the mock test server.PR created automatically by Jules for task 12172722168675999540 started by @ffalcinelli